package com.xiyue.leaspring.service;

import java.util.List;
import java.util.function.Consumer;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.xiyue.leaspring.po.Dept;

@ContextConfiguration(locations = {"classpath:spring/spring-jpa.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
public class IDeptServiceTest2 {

	@Autowired
	private IDeptService_CrudRepository deptService;
	
	@Test
	public void testAdd() {
		Dept vo = new Dept();
		vo.setDname("天空部");
		System.out.println(this.deptService.add(vo));
	}

	@Test
	public void testGetlist() {
		List<Dept> allDepts = this.deptService.list();
		allDepts.forEach(new Consumer<Dept>() {
			public void accept(Dept dept) {
				System.out.println(dept);
			}
		});
	}
	
	@Test
	public void testGet() {
		Dept dept = this.deptService.get(1L);
		System.out.println(dept);
	}
	
}
